const Koa = require('koa')
const logger = require('koa-logger')
const bodyParser = require('koa-bodyparser')

const errorHandler = require('./error-handler')

const useRoutes = require('../routers')

const app = new Koa()

app.use(logger())
app.use(bodyParser())

useRoutes.call(app)

app.on('error', errorHandler)

module.exports = app




